using System;
using System.Xml;
using Technullogy.Web.UI.TwcWeather;
using System.Linq;

namespace Technullogy.Web.UI.Weather.TechnullogyWeather
{
    internal class DayPartDetails
    {
        #region Properties
        public String BriefDescription { get; set; }
        public String Description { get; set; }
        public String Icon { get; set; }
        public String Humidity { get; set; }
        public String PrecipChance { get; set; }

        private Wind _wind = new Wind();
        public Wind Wind
        {
            get { return _wind; }
            set { _wind = value; }
        }
        #endregion

        public DayPartDetails(weather twcWeather, String day, String dayChar)
        {
            weatherDayfDayPart xmlDayPart = twcWeather.dayf.day.Where(d => d.d == day).FirstOrDefault().part.Where(p => p.p == dayChar).FirstOrDefault();
            Icon = xmlDayPart.icon;
            Description = xmlDayPart.t;
            Wind.Degrees = xmlDayPart.wind.d;
            Wind.Direction = xmlDayPart.wind.t;
            Wind.Gust = xmlDayPart.wind.gust;
            Wind.Speed = xmlDayPart.wind.s;
            BriefDescription = xmlDayPart.bt;
            PrecipChance = xmlDayPart.ppcp;
            Humidity = xmlDayPart.hmid;
        }
    }
}